// 1. js reverse + 循环比较
// 2. 双指针 i j 
// 3. 双端队列 两端出队 比较

import DoubleQueue from "./dounble_queue"


function palindromeChecker(aString:string):boolean{
    if(aString===undefined || aString == null || aString.length == 0){
        return false
    }

    // 忽略大小写
    const lowerString:string=aString.toLocaleLowerCase().split(' ').join('')
    const queue:DoubleQueue<string>=new DoubleQueue()
    for(let i=0,len=lowerString.length;i<len;i++){
        queue.addBack(lowerString.charAt(i))
    }
    while(queue.size()>1){
        if(queue.removeBack() !== queue.removeFront()){
            return false
        }
    }
    return true
}

console.log(palindromeChecker('abba'))